﻿using Inovout.Cloud.Applications.Security.Models;
using Inovout.Services;
using System;

namespace Inovout.Cloud.Applications.Security.Services
{
    public class NativeApplicationCredentialService : RepositoryService<NativeApplicationCredential>, INativeApplicationCredentialService
    {
        public override void Save(NativeApplicationCredential nativeApplicationCredential)
        {
            var guid = Guid.NewGuid().ToString("N");
            nativeApplicationCredential.ClientId = guid;
            nativeApplicationCredential.ClientSecret = guid;
            nativeApplicationCredential.ApplicationUser.Credentials.Add(nativeApplicationCredential);
            base.Save(nativeApplicationCredential);

        }
    }
}
